<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:sec="http://www.springframework.org/security/tags"
	xmlns:p="http://primefaces.org/ui">

<f:view locale="#{localeSwitcher.locale}">

	<h:head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport"
			content="width=device-width, initial-scale=1.0, user-scalable=no" />
		<h:outputScript library="primefaces" name="jquery/jquery.js" />

		<h:outputStylesheet name="css/base.css" />
		<h:outputStylesheet name="css/page.css" />
		<title><ui:insert name="pageTitle"></ui:insert></title>
		<ui:insert name="head-extra" />
	</h:head>

	<h:body>
		<f:facet name="last">

		</f:facet>

		<div id="header" class="ui-header">

			<div class="ui-wrap-content"></div>

		</div>
		<!-- end header -->
		<div id="top"></div>
		<!-- contentDiv -->
		<div id="contentDiv">
			<div class="ui-wrap-content" style="height: 100%;">
				<h:graphicImage value="#{resource['images:logo.jpg']}"
					class="header_logo" />
				<div id="head">
					<div id="headLangBox">

						<div class="_50"
							style="width: 200px; float: right;">
							<h:form prependId="false">
								<h:panelGrid columns="8">
									<h:form id="selectLanguage">
										<sec:authorize ifAnyGranted="ROLE_ADMIN, ROLE_USER">
											<h:outputLabel for="user" value="#{out.hi}, " />
											<h:link id="user" value="#{request.userPrincipal.name}"
												outcome="/pages/secure/admin/profile.xhtml" />
										</sec:authorize>
										<p:commandLink action="#{localeSwitcher.changeLocal('hu')}"
											onclick=" location.reload()" style="margin-left: 30px;">
											<h:graphicImage name="images/Hungary.png" />
										</p:commandLink>
										<p:commandLink action="#{localeSwitcher.changeLocal('en')}"
											onclick=" location.reload()" style="margin-left: 5px;">
											<h:graphicImage name="images/England.png" />
										</p:commandLink>


									</h:form>
								</h:panelGrid>
							</h:form>

						</div>

					</div>
					<h2 style="padding-top: 0px;">
						Webshop admin
						<ui:insert name="header"></ui:insert>
					</h2>
					<h:form>
						<p:growl id="messages" />

						<p:menubar>
							<sec:authorize
								ifAnyGranted="ROLE_ADMIN,ROLE_IMPORTER,ROLE_EXPORTER,ROLE_LEADER,ROLE_PRODUCT_MANAGER">
								<p:submenu label="#{out.data}" icon="ui-icon-document">
									<sec:authorize ifAnyGranted="ROLE_ADMIN,ROLE_LEADER,ROLE_PRODUCT_MANAGER">
									<p:menuitem value="Manage Category"
										outcome="/pages/secure/admin/manage_category.xhtml" />									
									</sec:authorize>
									<p:menuitem value="Manage Products"
										outcome="/pages/secure/admin/manage_product.xhtml" />
									<p:menuitem value="Manage Warehouses"
										outcome="/pages/secure/admin/warehouses.xhtml" />
								</p:submenu>
							</sec:authorize>
							<sec:authorize
								ifAnyGranted="ROLE_ADMIN,ROLE_PARTNER_MANAGER">
								<p:submenu label="Partner details">
									<p:menuitem value="Show partner details"
										outcome="/pages/secure/admin/partners.xhtml" />								
								</p:submenu>
								</sec:authorize>
							<sec:authorize ifAnyGranted="ROLE_ADMIN,ROLE_LEADER">
								<p:submenu label="#{out.leader}" icon="ui-icon-document">
									<p:menuitem value="Orders"
										outcome="/pages/secure/admin/leader_registry.xhtml" />
									<p:separator />
									<p:menuitem value="#{out.income_diagram}"
										outcome="/pages/secure/admin/leader_diagrams/income.xhtml" />
									<p:menuitem value="#{out.warehouse_diagram}"
										outcome="/pages/secure/admin/leader_diagrams/warehouse.xhtml" />
									<p:menuitem value="#{out.order_by_partner_diagram}"
										outcome="/pages/secure/admin/leader_diagrams/partner_income.xhtml" />
									<p:menuitem value="#{out.order_by_daily_income_diagram}"
										outcome="/pages/secure/admin/leader_diagrams/dailyIncome.xhtml" />
									<p:menuitem value="#{out.order_by_status_diagram}"
										outcome="/pages/secure/admin/leader_diagrams/status.xhtml" />
								</p:submenu>
							</sec:authorize>
							<sec:authorize ifAnyGranted="ROLE_ADMIN,ROLE_IMPORTER">
								<p:submenu label="#{out.importers}" icon="ui-icon-document">
									<p:menuitem value="Import"
										outcome="/pages/secure/admin/importer.xhtml" />
									<p:menuitem value="Create import list"
										outcome="/pages/secure/admin/importer_necessary_products.xhtml" />
								</p:submenu>
							</sec:authorize>
							<sec:authorize ifAnyGranted="ROLE_ADMIN,ROLE_EXPORTER">

								<p:menuitem value="#{out.exporter_title}"
									url="/pages/secure/admin/exporter.xhtml" />
							</sec:authorize>
							<sec:authorize ifAnyGranted="ROLE_ADMIN">

								<p:menuitem value="#{out.admin_title}"
									url="/pages/secure/admin/admin.xhtml" icon="ui-icon-unlocked" />
							</sec:authorize>
							<sec:authorize ifAnyGranted="ROLE_USER">
								<p:menuitem value="#{out.logout}"
									url="/j_spring_security_logout" icon="ui-icon-extlink" />
							</sec:authorize>
							<f:facet name="options">




							</f:facet>
							<sec:authorize ifAnyGranted="ROLE_ANONYMOUS">
								<p:menuitem value="#{out.login}" id="login"
									url="/pages/unsecure/login.xhtml" icon="ui-icon-unlocked" />
								<p:menuitem value="#{out.signup}"
									url="/pages/unsecure/signup.xhtml" icon="ui-icon-unlocked" />
							</sec:authorize>

						</p:menubar>

					</h:form>
				</div>
				<p:separator />
				<div id="content">
					<div id="contentInside">
						<ui:insert name="content" />
					</div>
				</div>

			</div>
		</div>
		<!-- end contentDiv -->

		<!-- footer -->

		<div id="footer" class="ui-footer">
			<h:outputText value="@Copyright 2015" />
		</div>

		<!-- end footer -->
		<div id="bottom"></div>
	</h:body>

</f:view>
</html>
